/**
* gdk_rgba_parse:
- * @spec: the string specifying the color
* @rgba: the #GdkRGBA struct to fill in
+ * @spec: the string specifying the color
*
* Parses a textual representation of a color, filling in
* the <structfield>red</structfield>, <structfield>green</structfield>,
* Since: 3.0
**/
gboolean
-gdk_rgba_parse (const gchar *spec,
- GdkRGBA *rgba)
+gdk_rgba_parse (GdkRGBA *rgba,
+ const gchar *spec)
{
gboolean has_alpha;
gdouble r, g, b, a;
GdkRGBA expected;
gboolean res;
- res = gdk_rgba_parse ("foo", &color);
+ res = gdk_rgba_parse (&color, "foo");
g_assert (!res);
- res = gdk_rgba_parse ("", &color);
+ res = gdk_rgba_parse (&color, "");
g_assert (!res);
expected.red = 100/255.;
expected.green = 90/255.;
expected.blue = 80/255.;
expected.alpha = 0.1;
- res = gdk_rgba_parse ("rgba(100,90,80,0.1)", &color);
+ res = gdk_rgba_parse (&color, "rgba(100,90,80,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
expected.green = 0.3;
expected.blue = 0.2;
expected.alpha = 0.1;
- res = gdk_rgba_parse ("rgba(40%,30%,20%,0.1)", &color);
+ res = gdk_rgba_parse (&color, "rgba(40%,30%,20%,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
- res = gdk_rgba_parse ("rgba( 40 % , 30 % , 20 % , 0.1 )", &color);
+ res = gdk_rgba_parse (&color, "rgba( 40 % , 30 % , 20 % , 0.1 )");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
expected.green = 0.0;
expected.blue = 0.0;
expected.alpha = 1.0;
- res = gdk_rgba_parse ("red", &color);
+ res = gdk_rgba_parse (&color, "red");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
expected.green = 0x8080 / 65535.;
expected.blue = 1.0;
expected.alpha = 1.0;
- res = gdk_rgba_parse ("#0080ff", &color);
+ res = gdk_rgba_parse (&color, "#0080ff");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
}
orig = g_strdup (setlocale (LC_ALL, NULL));
res = gdk_rgba_to_string (&rgba);
- gdk_rgba_parse (res, &out);
+ gdk_rgba_parse (&out, res);
g_assert (gdk_rgba_equal (&rgba, &out));
setlocale (LC_ALL, "de_DE.utf-8");
if (!g_value_get_string (value))
set_bg_color (celltext, NULL); /* reset to background_set to FALSE */
- else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
+ else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
set_bg_color (celltext, &rgba);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));
if (!g_value_get_string (value))
set_fg_color (celltext, NULL); /* reset to foreground_set to FALSE */
- else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
+ else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
set_fg_color (celltext, &rgba);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));